import subprocess 
from functools import partial
subprocess.Popen = partial(subprocess.Popen, encoding="utf-8") #TypeError: Cannot read properties of undefined (reading 'apply')
import requests
import execjs
headers = {
    'Accept': 'text/plain, */*; q=0.01',
    'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', 
    'Cache-Control': 'no-cache',
    'Connection': 'keep-alive',
    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
    'Origin': 'https://www.endata.com.cn',
    'Pragma': 'no-cache',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0',
    'X-Requested-With': 'XMLHttpRequest',
    'sec-ch-ua': '"Microsoft Edge";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
}

data = {
    'startTime': '2025-04-01',
    'MethodName': 'BoxOffice_GetMonthBox',
}

response = requests.post('https://www.endata.com.cn/API/GetData.ashx', headers=headers, data=data)
js = execjs.compile(open ('艺恩des.js', 'r', encoding='utf-8').read())
data = js.call('webInstace.shell',response.text)
print(data)